﻿using System.Collections.Generic;
using Firefly.ExtensionMethods;
using Firefly.Framework.ContentManagement;
using Firefly.Framework.Graphics;
using Firefly.Framework.Windows.Forms;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Firefly.Framework.Windows
{
    public class Desktop : Control
    {
        public Desktop()
        {
        }

        protected override Rectangle Interior 
        { 
            get { return GraphicsService.Instance.Viewport.ToRectangle(); }
        }

        protected override void UpdateRectangles()
        {
            DrawRectangle = GraphicsService.Instance.Viewport.ToRectangle();
        }

        #region IHasContent Members

        public override void LoadContent()
        {
            Children = ContentService.Instance.Load<List<Control>>(WindowsService.Instance.LayoutPath + "LayoutDefinition");

            foreach (Control c in Children)
            {
                c.Parent = this;
            }
        }

        #endregion

        #region IDrawable Members

        public override void Draw(GameTime gameTime)
        {
            DrawChildren(gameTime);
        }

        #endregion
    }
}
